/**
 * 阅读tab相关接口
 */
import type { ExerciseListResult, GetCourseListParams, ListParams, ListResult } from './type';
import type { ReadingBookResult } from '@/api/home/type';
import { get, post } from '@/utils/request';

enum URL {
  getCourseList = '/app/userMainPage/getCourseList',
  getExerciseList = '/tk/exercise/list',
  save = '/app/exercises/saveExercises',
}

// 查看课表
export const getCourseList = (data: GetCourseListParams) => get<{ total: number; rows: Array<ReadingBookResult>; code?: number }>({ url: URL.getCourseList, data });

// 获取练习题
export const getExerciseList = (data: ListParams) => post<ExerciseListResult>({ url: URL.getExerciseList, data: { ...data, type: '20', tenantId: '2' } });

// 保存练习题
export const saveExercises = (data: ListResult) => post<any>({ url: URL.save, data });
